<template>
  <el-form :model="searchInfo">
    <div v-for="(item, index) in searchData" :key="index">
      <el-form-item v-if="item.type == 'input'" :label="item.label">
        <el-input v-model:value="searchInfo[item.value]" :placeholder="item.placeholder" />
      </el-form-item>
      <el-form-item v-if="item.type == 'select'" :label="item.label">
        <el-select
          v-model:value="searchInfo[item.value]"
          :placeholder="item.placeholder"
          :options="item.menu"
          style="width: 120px"
        >
          <el-option :value="item.menu.value"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item v-if="item.type === 'picker'" :label="item.label">
        <el-date-picker
          v-model:value="searchInfo[item.value]"
          show-time
          type="date"
          :placeholder="item.placeholder"
          style="width: 100%"
        />
      </el-form-item>
    </div>
  </el-form>
</template>

<script setup lang="ts">
import { reactive } from 'vue'
const props = defineProps(['searchInfo', 'searchData'])

// 变成响应式
const searchInfo: any = reactive(props.searchInfo)
const searchData = reactive(props.searchData)
</script>

<style scoped></style>
